package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.HatchetIssBankMapper;
import com.ruoyi.system.domain.HatchetIssBank;
import com.ruoyi.system.service.IHatchetIssBankService;
import com.ruoyi.common.support.Convert;

/**
 * 绑定的银行列 服务层实现
 * 
 * @author ruoyi
 * @date 2019-02-16
 */
@Service
public class HatchetIssBankServiceImpl implements IHatchetIssBankService 
{
	@Autowired
	private HatchetIssBankMapper hatchetIssBankMapper;

	/**
     * 查询绑定的银行列信息
     * 
     * @param id 绑定的银行列ID
     * @return 绑定的银行列信息
     */
    @Override
	public HatchetIssBank selectHatchetIssBankById(String id)
	{
	    return hatchetIssBankMapper.selectHatchetIssBankById(id);
	}
	
	/**
     * 查询绑定的银行列列表
     * 
     * @param hatchetIssBank 绑定的银行列信息
     * @return 绑定的银行列集合
     */
	@Override
	public List<HatchetIssBank> selectHatchetIssBankList(HatchetIssBank hatchetIssBank)
	{
	    return hatchetIssBankMapper.selectHatchetIssBankList(hatchetIssBank);
	}
	
    /**
     * 新增绑定的银行列
     * 
     * @param hatchetIssBank 绑定的银行列信息
     * @return 结果
     */
	@Override
	public int insertHatchetIssBank(HatchetIssBank hatchetIssBank)
	{
	    return hatchetIssBankMapper.insertHatchetIssBank(hatchetIssBank);
	}
	
	/**
     * 修改绑定的银行列
     * 
     * @param hatchetIssBank 绑定的银行列信息
     * @return 结果
     */
	@Override
	public int updateHatchetIssBank(HatchetIssBank hatchetIssBank)
	{
	    return hatchetIssBankMapper.updateHatchetIssBank(hatchetIssBank);
	}

	/**
     * 删除绑定的银行列对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteHatchetIssBankByIds(String ids)
	{
		return hatchetIssBankMapper.deleteHatchetIssBankByIds(Convert.toStrArray(ids));
	}

	/**
	 * 通过bankCode查询银行
	 * @param bankCode
	 * @return
	 */
	public HatchetIssBank selectHatchetIssBankByBankCode(String bankCode) {
		HatchetIssBank hatchetIssBank = new HatchetIssBank();
		hatchetIssBank.setBankCode(bankCode);
		List<HatchetIssBank> bankList = hatchetIssBankMapper.selectHatchetIssBankList(hatchetIssBank);
		if (bankList != null && bankList.size()>0) {
			return bankList.get(0);
		}
		return null;
	}
	
}
